<template>
    <el-select
        v-model="modelValue"
        filterable
    >
        <el-option
            v-for="item in options"
            :key="item.admin_id"
            :label="item.username"
            :value="item.admin_id"
        />
    </el-select>
</template>
<script setup lang="ts">
import { onMounted, reactive, ref } from "vue";
import { getAdminUserList } from "@/api/authority/adminUser";
import { message } from "ant-design-vue";
import type { AdminUserFilterParams } from "@/types/authority/adminUser";

const modelValue = defineModel({
    default: () => 0,
    type: [Number]
});
const options = ref();

onMounted(() => {
    getUserList();
});
const filterParams = reactive({
    page: 1,
    size: 999,
});
const getUserList = async () => {
    try {
        options.value = [
            {
                admin_id: -1,
                username: "全部客服"
            }
        ]
        const result = await getAdminUserList({ ...filterParams });
        options.value.push(...result.filter_result)
    } catch (error: any) {
        message.error(error.message);
    } finally {
    }
};
</script>
<style scoped lang="less">

</style>
